import request from "../index";
import { version, channelId } from "@/config";

// 热门搜索
export function hotSearchProduct() {
  return request({
    url: `/ssop/api/goods-v${version}/hot/goods/keyWord?channelId=${channelId}`,
    method: "post",
  })
}

// 搜索
export function searchProduct({ from="", word="", current=1 }) {
  const params = {
    pageNo: current,
    pageSize: 10
  }
  if(from && from === 'keyword'){
    params.keyWord = word
  }else{
    params.goodsName = word
  }
  return request({
    url: `/ssop/api/goods-v${version}/applet/goods/hot/goods/all`,
    method: "get",
    params
  })
}
